package org.meb.speedway.web.log;

public class LogStyleUtil {

	private LogStyleUtil() {

	}

	public static void styleAsImportLog(Log log) {
		for (int i = 0; i < log.getEntries().length; i++) {
			LogEntry entry = log.getEntries()[i];
			String styleClass = "log-m";
			String detailStyleClass = "log-d";
			String messageLowerCase = entry.getMessage().toLowerCase();
			if (messageLowerCase.startsWith("[error]")) {
				styleClass += " log-error";
				detailStyleClass += " log-error";
			} else if (messageLowerCase.startsWith("[info]") && messageLowerCase.contains("merge")) {
				styleClass += " log-notify";
				detailStyleClass += " log-notify";
			}
			entry.setStyleClass(styleClass);
			entry.setDetailStyleClass(detailStyleClass);
		}
	}
}
